/*
 * @Author: moonwater 13812995013@163.com
 * @Date: 2025-03-04 09:45:04
 * @LastEditors: moonwater 13812995013@163.com
 * @LastEditTime: 2025-03-04 14:14:18
 * @FilePath: \盐师22Git仓库\day07\School.java
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
package day07;

public class School {
    //属性
    private String name;
    private int num;
    // private String library;

    //1.静态成员变量初始化的第一种方式 显示初始化
    public static String library = "栋梁图书馆";

    //2.静态成员变量初始化的第二种方式 静态代码块
    static{
        library = "栋梁图书馆-静态代码块";
    }
    //无优先级 按照代码顺序执行 哪个赋值在后面 最终就是哪个值

    public void setLibrary(String library){
        //通过对象调用共享属性
        this.library = library;
    }

    //构造器
    public School(){

    }

    //全参构造器
    public School(String name,String library,int num){
        this.name = name;
        this.library = library;
        this.num = num;
    }

     //方法
     public void show(){
        System.out.println("学校名称:"+ name);
        System.out.println("图书馆:"+ library);
        System.out.println("学生人数:"+ num);
    }
    
}
